var dictionary={" ":" "
	,"dog":"sam"
	,"mutt":"sam"
	,"me":"sam"
	,"i":"sam"
	
	,"rabbit":"max"
	,"rabbit thingy":"max"
	,"bunny":"max"
	,"friend":"max"
	,"little friend":"max"
	
	,"look at":"see"
	,"look around":"see"
	,"look":"see"
	,"watch":"see"
	,"inspect":"see"
	,"observe":"see"
	,"check":"see"
	
	,"around":""
	
	,"pocket":"inventory"
	,"pockets":"inventory"
	,"stuff":"inventory"
	,"bag":"inventory"
};

var state={" ":" "
	,"room":"startup"
	,"inventory":{}
};

var actions={" ":" "
	,"room-startup":{" ":" "
		,"!startup":
			function(){
				echo(""
					,"Sam: Well, here we are in this great dirty hole, little buddy."
					,"Max: Yeah, and this cave's pretty filthy, too."
					,"Sam: Yeah, and this... Wait, what did you think I was talking about?"
					,"Max: What did I think who was something about what?"
					,"Sam: Never mind. Let's find a way out of this cave."
					,"Max: I hope it involves overly-complicated puzzles!"
					,"Sam: I'm sure it will, little buddy."
					//FIXME
					,"Sam: I think this is the part where we are supposed to explain the controls"
					,"Max: Don't tell me. They fired the intern who was supposed to write the README file."
					,"Sam: Right, little buddy. It's once again up to us."
					,"Max: I usually just cry out HELP when I'm lost."
					,"Sam: No, you don't."
				);
				setState("room","molecave");
			}
	}
	
	,"room-molecave":{" ":" "
		,"!scenedesc":[
			"Sam: The cave where we banished Skunkape to the penal zone. Apparently, the Molepeople disappeared after the appearance of what seems to be the mortal remains of our fluffy selves."
		].join("\n")
		
		,"see":"!scenedesc"
		,"see cave":"!scenedesc"
		,"see molecave":"!scenedesc"
		,"see molemancave":"!scenedesc"
		,"see mole cave":"!scenedesc"
		,"see moleman cave":"!scenedesc"
	}
	
	,"global":{" ":" "
		,"!not unerstood":
			function (){ 
				echor("Sam: No can do"
				,"Sam: What?"
				,"Sam: I'll do it. If only I knew what it was.");
			}
		,help:
			["Sam: He's asking for help."
			,"Max: What a douche"
			,""
			,"SYSTEM HELP"
			,"Available Commands:"
			,"HELP, RESTART, INVENTORY, USE, LOOK, etc."
			,""
			,"Max: That's it?"
			,"Sam: Apprently, developers enjoy torturing the users."
			,"Max: Being a game developer suddenly sounds exciting!"
			].join("\n")
		
		,etc: "Sam: I really hope you're not serious."
		,restart: "Enter shutdown -r now if you really, really want to restart"
		,"shutdown r now":function(){ reset(); }
		

		
		,"inventory":function(){
			var filled=false;
			for(var i in state.inventory){
				filled=true;break;
			}
			
			if(filled){
				echo("Sam: I should really clean out my pockets every once in a while:");
				for(var i in state.inventory)
					action("+inv_list_"+i);
			}else
				echo("Sam: Hey, were's all my cool stuff?");

		}
		,"see inventory":function(){ action("inventory"); }
		
		,"see max":"Sam: It's my cute little bunny friend"
		,"see *":"What's a %0%?"
		,"strip":
			["Sam: You are aware children are watching?"
			,"Max: I'll do it."
			].join("\n")
		
		,"strip sam":function(){ action("strip"); }
		,"strip max":"Sam: This is sick and besides, it's already done."
		
		,"!pc":
			"Sam: Max, apparently this guy thinks we are a PC.\n"
			+"Max: Usually I'd pull his spine out for that, but if he was around during the old days then this guy has suffered enough."
		
		,"dir": "!pc","dir *": "!pc","format": "!pc","format *": "!pc"
		,"ls": "!pc","ls *": "!pc","cd": "!pc","cd *": "!pc"
		
		,"dbg state":
			function(){
				for(var i in state)
					echo(i+": "+JSON.stringify(state[i]));
			}
	}
};

